package insight.google.game.era.bo.policy.gamecard;

import java.util.Collection;
import java.util.Map;

import insight.google.game.era.bo.GameRoom;
import insight.google.game.era.bo.GameUser;
import insight.google.game.era.bo.card.GameCard;
import insight.google.game.era.bo.policy.AbstractPolicy;
import insight.google.game.era.client.proxy.PlayerClientProxy;
import insight.google.game.era.client.proxy.PlayerClientProxyImpl;
import insight.google.game.era.core.Util;

public class BowPolicy extends AbstractPolicy {

    /**
	 * 
	 */
	private PlayerClientProxy playerClientProxy;

	@Override
	public boolean execute(GameUser original, GameUser[] targets, Map params) {
		// TODO Auto-generated method stub
        playerClientProxy = PlayerClientProxyImpl.getInstance();

		GameRoom room = Util.getRoom();
		GameCard card = room.getCardByCardName("bow");
		original.setAttackDistance(card.getDistance());
		Collection<GameUser> attackUsers = room.getAttackableUsers(original);
		
        //get js component id
        String jsComponentId = (String)params.get("jsComponenetId");
//        playerClientProxy.registerAttackableUser(original.getScriptProxy(), jsComponentId, attackUsers);
        original.registerAttackableUser(jsComponentId);

//        playerClientProxy.setActive(original.getScriptProxy(), jsComponenetId, true);
//        trgUser.setActiveCards(activeCards,jsComponentId);
        original.setClientActive(true, jsComponentId);
        return true;
	}

}
